#include "GrammarTest.h"

USING_NS_TEST;

const int GrammarTest::s_mId(011);
const std::string GrammarTest::sc_mConstString("grammer test");

GrammarTest* elloop_test::GrammarTest::run()
{
	/*psln(sc_mConstString);
	psln(s_mId);*/
	/*for (int i=0; i<Elem_Length+1; ++i) {
		psln(i);
		psln(i < Elem1);
		psln(i < Elem2);
		psln(i < Elem3);
		psln(i < Elem_Length);
	}*/
	//testPtr();
	//testDerivedDataField();
	//testCallMethodOutsideClass();
    testEnumFromClassDefinedInCppFile();
	return this;
}

void elloop_test::GrammarTest::testPtr()
{
	SimpleClass * classPtr(NULL);
	SimpleClass* temp = dynamic_cast<SimpleClass*>(classPtr);
	if (temp) {
		psln(temp->getData());
	}

	if (classPtr) {
		delete classPtr;
	}
}

void elloop_test::GrammarTest::testDerivedDataField()
{
	SimpleDerivedCalss * sdc = new SimpleDerivedCalss(19009, "what a fuck derived class");
	psln(sdc->getData());
	psln(sdc->desc());
	delete sdc;
}

void elloop_test::GrammarTest::testCallMethodOutsideClass()
{
	DefinedInClass * dic = new DefinedInClass(this);
	dic->mData = 1001;

	dic->triggerCallOutside();
}

void elloop_test::GrammarTest::executeOuesideMethod( DefinedInClass * pExecuter )
{
	pExecuter->callFromOutside();
}

void elloop_test::GrammarTest::testEnumFromClassDefinedInCppFile()
{
    psln(ClassInCpp::ImClassInCpp);
}


